/*
 * @Author: yangni 920556271@qq.com
 * @Date: 2023-12-25 17:42:54
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-03-26 15:30:31
 * @FilePath: /yt-devops/lib/pages/site/site_overview/component/animate_line/line_painter.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'dart:math';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:svg_path_parser/svg_path_parser.dart';
import 'package:yt_devops/styles/styles.dart';

class LinPainter extends CustomPainter {
  /// svg路径
  String path;
  // 线条颜色
  Color lineColor;

  late Paint mPaint;
  Path _path = Path();

  LinPainter(
    this.path,
    this.lineColor,
  );

  @override
  void paint(Canvas canvas, Size size) {
    mPaint = Paint()
      ..color = lineColor
      ..strokeWidth = 2
      ..style = PaintingStyle.stroke;

    _path = parseSvgPath(path);

    canvas.drawPath(_path, mPaint);
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
}
